package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.goods.pojo.Category;
import com.changgou.goods.pojo.Sku;
import com.changgou.goods.pojo.Spu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name="goods")
public interface GoodsFeign {
	@GetMapping("/category/{id}")
	public Result<Category> findById(@PathVariable("id") Integer id);
	@GetMapping("/sku/spu/{spuId}")
	public List<Sku> findSkuListBySpuId(@PathVariable("spuId") String spuId);
	@GetMapping("/spu/findSpuById/{id}")
	public Result<Spu> findSpuById(@PathVariable("id") String id);

	@GetMapping("/sku/{id}")
	public Result<Sku> findById(@PathVariable("id") String id);
	//递减库存
	@PostMapping("/sku/decr/count")
	public Result decrCount(@RequestParam("username")String username);

	@RequestMapping("/sku/resumeStockNum")
	public Result resumeStockNum(@RequestParam("skuId") String skuId,@RequestParam("num")Integer num);
}
